<?php
require_once("mysqlUser/mysql.php");

class enemy
{
	public static $table = "enemy";
	//////////////////////////////////////////////////
	
	private $name;		//显示名称
	private $radius;	//碰撞半径
	private $mspd;		//移动速度
	private $mran;		//巡逻范围半径
	private $eran;		//警戒范围半径
	private $aran;		//攻击范围半径
	private $pow;		//攻击力
	private $actrate;	//攻击频率
	private $hp;		//hp
	private $def;		//防御力
	
	public function __set($name, $value) 
	{
		if ( isset( $this->$name ) ){}
		else $this->$name = $value;
	}
	
	public function __get($name) 
	{
		if( isset( $this->$name ) ) return $this->$name;
		else trigger_error( $name . ' variables undefined',  E_USER_NOTICE );
	}
	
	public function enemy($id)
	{
		$command = "select * from ".enemy::$table." where id=$id";
		$result = mysql::run($command);
		$data=mysql_fetch_array($result);
		
		$this->name = $data["name"];
		$this->radius = $data["radius"];
		$this->mspd = $data["mspd"];
		$this->mran = $data["mran"];
		$this->eran = $data["eran"];
		$this->aran = $data["aran"];
		$this->pow = $data["pow"];
		$this->actrate = $data["actrate"];
		$this->hp = $data["hp"];
		$this->def = $data["def"];
	}
	
	
	
}
?>